﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MineCraft_Command_Editor.Project
{
    public partial class CreateProject : Form
    {

        public string localFilePath;

        public CreateProject()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Title = "保存工程文件(请选择一个空文件夹)";
            saveFileDialog1.Filter = "MineCraft Function Project File(*.mfproj)|*.mfproj";
            DialogResult result = saveFileDialog1.ShowDialog();
            if (result == DialogResult.OK)  //DialogResult为枚举类,OK为保存
            {
                //获得文件路径
                localFilePath = saveFileDialog1.FileName.ToString();
                textBox1.Text = localFilePath;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Java版与Badrock(基岩)版有很大的不同。","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("所能兼容的最低版本。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void CreateProject_Load(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            Random rd = new Random();
            int p1 = rd.Next(10000000, 99999999);
            int p2 = rd.Next(1000, 9999);
            int p3 = rd.Next(1000, 9999);
            c_1.Text = p1.ToString();
            c_2.Text = p2.ToString();
            c_3.Text = p3.ToString();

            int p4 = rd.Next(100000, 999999);
            int p5 = rd.Next(100000, 999999);
            c_4.Text = p4.ToString() + p5.ToString();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (domainUpDown1.Text.Split(' ')[1] == "Badrock")
            {
                //基岩版逻辑
                CreateBadRockEdition.CreateFileSystem(textBox1.Text,domainUpDown1.Text.Split(' ')[3], domainUpDown1.Text.Split(' ')[3], textBox2.Text, new List<string> { c_1.Text, c_2.Text, c_3.Text, c_4.Text },textBox1.Text,textBox1.Text);
            }
        }
    }
}
